package ObjectStatic.ObjectStaticExercise001;

/**
 * ClassName:Student
 * Package:ObjectStatic.a01StaticDemo001
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/1/19-11:02
 * @Version:v1.0
 */
public class Student {
    private String name;
    private int age;
    private String gender;
    public static String teacherName;//+static 共享同一个老师
    //静态特点
    /*
    * 被该类所有对象共享
    * 不属于对象,属于类
    * 静态变量是随着类的加载而加载的,优先于对象出现的
    *
    * 调用方式
    * 类名调用
    * 对象名调用*/


    public Student() {
    }

    public Student(String name, int age, String gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    //行为
    public void study() {
        System.out.println(name + "正在学习");
    }

    public void show() {
        System.out.println(name + "," + age + "," + gender+","+teacherName);
    }

}

//Javabean类：用来描述一类事物的类
//测试类：用来检查其他类是否书写正确,带有main方法的类,是程序的入口
/*工具类：不是用来描述一类事物的,而是帮我们做一些事情的类
        1.类名见名知意
        2.私有化构造方法
        3.方法定义为静态*/
